/*
 Copyright (c) Whitemice Consulting, 2007, 2008, 2009
 Adam Tauno Williams <awilliam@whitemice.org>
 License: MIT/X11

 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 in the Software without restriction, including without limitation the rights
 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 copies of the Software, and to permit persons to whom the Software is
 furnished to do so, subject to the following conditions:

 The above copyright notice and this permission notice shall be included in
 all copies or substantial portions of the Software.
 
 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 THE SOFTWARE.
*/
using System;
using System.Collections;
using CookComputing.XmlRpc;

namespace Whitemice.ZOGI.RPC2
{	
  internal enum RPCMethod : uint
  {
    GetLoginAccount = 1,
    GetName = 2,
    GetFavorites = 3, 
    UnflagFavorites = 4,
    FlagFavorites = 5,
    GetObjectById = 6,
    GetObjectsById = 7,
    GetObjectVersions = 8,
    SearchForObjects = 9,
    PutObject = 10,
    DeleteObject = 11
  } 

	//[XmlRpcUrl("http://192.168.3.170/zidestore/so/adam/")]
	public interface IzOGIProxy
	{	
		[XmlRpcMethod("zogi.getLoginAccount")]
		XmlRpcStruct GetLoginAccount(int detail);
	
		[XmlRpcMethod("zogi.getTypeOfObject")]
		string GetName(string objectId);
	
	  /// Favorite Methods
		[XmlRpcMethod("zogi.getFavoritesByType")]
		Array GetFavorites(string entityName, int detail);
		
		[XmlRpcBegin("zogi.getFavoritesByType")]
    IAsyncResult BeginGetFavorites(string entityName, int detail, AsyncCallback acb, object state);
    
    [XmlRpcEnd]
    object EndGetFavorites(IAsyncResult asr);
		
		[XmlRpcMethod("zogi.flagFavorites")]
		void FlagFavorites(Array favoriteIds);
		
		[XmlRpcMethod("unflagFavorites")]
		void UnflagFavorites(Array favoriteIds);
						
		/// Sync Methods
		[XmlRpcMethod("zogi.getObjectById")]
		XmlRpcStruct GetObject(int objectId, int detail);
		
    [XmlRpcBegin("zogi.getObjectById")]
    IAsyncResult BeginGetObject(int objectId, int detail, AsyncCallback acb, object state);

    [XmlRpcEnd]
    XmlRpcStruct EndGetObject(IAsyncResult asr);		
		
		[XmlRpcMethod("zogi.getObjectsById")]
		Array GetObjects(Array objectIds, int detail);
		
    [XmlRpcBegin("zogi.getObjectsById")]
    IAsyncResult BeginGetObjects(Array objectIds, int detail, AsyncCallback acb, object state);

    [XmlRpcEnd]
    Array EndGetObjects(IAsyncResult asr);
		
		[XmlRpcMethod("zogi.getObjectVersionsById")]
		Array GetObjectVersions(Array objectIds);
		
    [XmlRpcBegin("zogi.getObjectVersionsById")]
    IAsyncResult BeginGetObjectVersions(Array objectIds, AsyncCallback acb, object state);

    [XmlRpcEnd]
    object EndGetObjectVersions(IAsyncResult asr);
    
		[XmlRpcMethod("zogi.searchForObjects")]
		Array SearchForObjects(string entityName, object query, int detail);
		
    [XmlRpcBegin("zogi.searchForObjects")]
    IAsyncResult BeginSearchForObjects(string entityName, object query, int detail, AsyncCallback acb, object state);

    [XmlRpcEnd]
    object EndSearchForObjects(IAsyncResult asr);

		[XmlRpcMethod("zogi.putObject")]
		object PutObject(XmlRpcStruct obj);
		
		[XmlRpcBegin("zogi.putObject")]
		IAsyncResult BeginPutObject(XmlRpcStruct obj, AsyncCallback acb, object state);
		
		[XmlRpcEnd]
		object EndPutObject(IAsyncResult asr);
		
		[XmlRpcMethod("zogi.deleteObject")]
		bool DeleteObject(int objectId, string[] flags);
		
		[XmlRpcBegin("zogi.deleteObject")]
		IAsyncResult BeginDeleteObject(int objectId, string[] flags, AsyncCallback acb, object state);
		
		[XmlRpcEnd]
		object EndDeleteObject(IAsyncResult asr);
		
		[XmlRpcMethod("zogi.getNotifications")]
		Array GetNotifications(DateTime start, DateTime end);
	} // end IProxy
} // end namespace